﻿using System;
using NUnit.Framework;

namespace BusinessFramework.Tests
{
    [TestFixture]
    public class RuleDebugger
    {
        public class EntityWithoutNPC
        {
            public string Name { get; set; }
        }

        [Test]
        [ExpectedException(typeof(InvalidOperationException))]
        public void ThrowExceptionWhenNoNPC()
        {
            BusinessFramework.RuleDebugger.ThrowExceptionWhenNoNotifyPropertyChanged = true;

            var e = new EntityWithoutNPC();
            var ee= EntityExtensions.RegisterTypedObject(e);
            ee.CreateValidationRule(x => x.Name.Length > 3)
                .Start();
        }
    }
}